(*
	controlVideo commandList - Control the videodisc. The commandList is a keyword list that
		specifies the specific commands/configuration to be set:

		The valid cmds are:

			cmd								Function
			ΡΡΡ								ΡΡΡΡΡΡ
			init or reset					Reset the player, configure the serial port (the baud rate is set to
												the highest available for the selected player).

			eject or reject				Eject the disc from the player.

			defaultComm					Set the default communications parameters for the selected player.

			audioOff						Turn off both audio channels.
			audio1On						Turn on audio channel 1 only.
			audio2On						Turn on audio channel 2 only.
			audioOn							Turn on both audio channels.

			pictureOn/pictureOff	Turn on/off the picture.

			framesOn/framesOff	Turn on/off the display of frame numbers.

			frameMode					Set player to frame number mode.
			chapterMode					Set player to chapter number mode.
			timeMode						Set player to time mode.

			<other>							Any other parameters are passed on to configureSPort. This
												includes port setting and baud rate selection.

	To compile and link this file using Macintosh Programmer's Workshop,

		pascal -w controlVideo.p
		link -m ENTRYPOINT -o HyperCommands -rt XCMD=8001 -sn Main=controlVideo ¶
			controlVideo.p.o "{MPW}"Libraries:interface.o "{MPW}"PLibraries:PasLib.o

	Copyright © 1987,88 Apple Computer, Inc.

	9/87 - Initial coding by Harry R. Chesley.
	2/88 - Changed to new interface specification by Harry R. Chesley.
*)

{$R-}

{$S controlVideo } 	{ Segment name must be the same as the command name. }

unit DummyUnit;

interface

uses MemTypes, QuickDraw, OSIntf, ToolIntf, HyperXCmd;

procedure EntryPoint(paramPtr: XCmdPtr);
	
implementation

type

Str31 = String[31];

procedure controlVideo(paramPtr: XCmdPtr); forward;

procedure EntryPoint(paramPtr: XCmdPtr);

	begin
		controlVideo(paramPtr);
	end;

procedure controlVideo(paramPtr: XCmdPtr);

	type
		audioModes = (off,oneOn,twoOn,stereo);

	var numberOfParms: integer;
		i: integer;
		typeOfVideo: str255;
		parm: str255;

	{$I XCmdGlue.inc}

	procedure Fail(errMsg: Str255); { set theResult and quit }
		begin
			paramPtr^.returnValue := PasToZero(errMsg);
			exit(controlVideo);
		end;

	{$I VideoUtil.inc}

	begin
		numberOfParms := paramPtr^.paramCount;

		GetStrGlobal('typeOfVideo',typeOfVideo);

		{ For each parameter... }
		for i := 1 to numberOfParms do
			begin
				{ Get the parameter. }
				GetStrParm(i,parm);
				{ Call the selected driver. }
				if typeOfVideo <> '' then EvalAndDispose(Concat('vidDrvr',typeOfVideo,'("control",',parm,')'))
				{ If there is no selected driver, pass it on to the serial port routines. }
				else SendCardMessage(Concat('configureSPort ',parm));
			end;
	end;

end.
